package org.stone.project.common.pojo.exception;

import lombok.Getter;
import lombok.Setter;
import org.stone.project.common.pojo.sysEnum.SystemCodeEnum;

/**
 * 外部可抛出，全局处理异常
 */
@Getter
@Setter
public final class BuzException extends RuntimeException
{
    private static final long serialVersionUID = 1L;

    public BuzException(Throwable cause) {
        super(cause);
        this.message = cause.getMessage();
    }

    public BuzException(String message) {
        super(message);
        this.message = message;
    }

    public BuzException(SystemCodeEnum code) {
        this.code = code;
        this.message = code.getDescribStr();
    }

    public BuzException(SystemCodeEnum code, String message ) {
        super(message);
        this.code = code;
        this.message = message;
    }

    /**
     * 错误码
     */
    private SystemCodeEnum code;

    /**
     * 错误提示
     */
    private String message;
}